<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //Math 常用方法
      //1、PI圆周率
      console.log(Math.PI) //全部大写一般为常量 且不可更改
      var a = Math.PI
      console.log(a)
      //2、取绝对值
      var a = -10
      console.log(Math.abs(a))
      //3、几次方
      console.log(Math.pow(2, -3))
      //4、平方根
      console.log(Math.sqrt(16))
      //5、获取最大值
      var res = Math.max(1, 2, 5, 9, 11)
      console.log(res)
      var arr = [1, 4, 9, 8, 3]
      var res = Math.max(...arr)
      console.log(res)
      //7、向上取整 ceil
      //8、向下取整 floor
      //9、四舍五入 round
    </script>
  </body>
</html>
